package com.raymond.service;

import com.raymond.entity.commons.BasisSupplierPageQueryReqVo;
import com.raymond.entity.commons.PageResponse;
import com.raymond.entity.commons.SupplierPageResponse;
import com.raymond.mapper.commons.BasisSupplierMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * desc-供应商 服务层实现
 *
 * @author houmenghe
 * @date 2025/04/27 14:05
 **/
@Service
@Slf4j
public class BasisSupplierService {

    @Autowired
    private BasisSupplierMapper basisSupplierMapper;

    public PageResponse<SupplierPageResponse> querySupplierList(BasisSupplierPageQueryReqVo query) {
        PageResponse<SupplierPageResponse> pageResponse = PageResponse.create(query);
        pageResponse.setDatas(basisSupplierMapper.selectSupplierList(query));
        if (query.isQueryTotal()) {
            pageResponse.setTotal(basisSupplierMapper.selectSupplierListCount(query));
        }
        return pageResponse;
    }

}
